cmake_minimum_required(VERSION 3.12)
project(MyProject)

find_package(Python 3.11 REQUIRED COMPONENTS Interpreter Development)

add_executable(learnJsocCpp json_learn.cpp)

# 关键修改：使用 ../ 访问上级目录
target_include_directories(learnJsocCpp PRIVATEcd 
    ${Python_INCLUDE_DIRS}
    ${CMAKE_CURRENT_SOURCE_DIR}/../include  # 指向 cp-spider/include
)

target_link_libraries(learnJsocCpp PRIVATE
    ${CMAKE_CURRENT_SOURCE_DIR}/../lib/libjsoncpp.a  # 指向 cp-spider/lib
    ${Python_LIBRARIES}
)

# # 添加头文件搜索路径
# target_include_directories(my_app PRIVATE
#     ${Python_INCLUDE_DIRS}
#     ${CMAKE_CURRENT_SOURCE_DIR}/include  # 包含 jsoncpp 头文件
# )

# # 链接库
# target_link_libraries(my_app PRIVATE
#     ${CMAKE_CURRENT_SOURCE_DIR}/lib/libjsoncpp.a  # jsoncpp 静态库
#     ${Python_LIBRARIES}                          # Python 库
# )